import Vue from 'vue'
import VueRouter from 'vue-router'
import homeView from '../views/HomeView.vue'
import loginPage from '../views/loginPage.vue'
Vue.use(VueRouter)
const routes = [
  {
    path: '/',
    name: 'home',
    component: homeView,
    redirect: '/homePageView',
    children: [
      {
        path: '/homePageView',
        name: 'homePageView',
        component: () => import(/* webpackChunkName: "about" */ '../views/HomePageView.vue'),
        children: [

        ]
      },
      {
        path: '/Chat',
        name: 'Chat',
        component: () => import(/* webpackChunkName: "about" */ '../views/Chat.vue')
      },
      {
        path: '/announcement',
        name: 'announcement',
        component: () => import(/* webpackChunkName: "about" */ '../views/AnnouncementView.vue')
      },
      {
        path: '/biddingHall',
        name: 'biddingHall',
        component: () => import(/* webpackChunkName: "about" */ '../views/BiddingHall.vue')
      },
      {
        path: '/announcementDetails',
        name: 'announcementDetails',
        component: () => import(/* webpackChunkName: "about" */ '../views/AnnouncementDetails.vue')
      },
      {
        path: '/bidView',
        name: 'bidView',
        component: () => import(/* webpackChunkName: "about" */ '../views/BidView1.vue')
      },
      {
        path: '/noBiddingDetails',
        name: 'noBiddingDetails',
        component: () => import(/* webpackChunkName: "about" */ '../views/NoBiddingDetails.vue')
      },
      {
        path: '/noBiddingDetailsOne',
        name: 'noBiddingDetailsOne',
        component: () => import(/* webpackChunkName: "about" */ '../views/NoBiddingDetailsOne.vue')
      },
      {
        path: '/noBiddingDetailsTwo',
        name: 'noBiddingDetailsTwo',
        component: () => import(/* webpackChunkName: "about" */ '../views/NoBiddingDetailsTwo.vue')
      },
      {
        path: '/biddingDetailsBidding',
        name: 'biddingDetailsBidding',
        component: () => import(/* webpackChunkName: "about" */ '../views/BiddingDetailsBidding.vue')
      },
      {
        path: '/endOfBiddingDetails',
        name: 'endOfBiddingDetails',
        component: () => import(/* webpackChunkName: "about" */ '../views/EndOfBiddingDetails.vue')
      },
      {
        path: '/inTheAnnouncement',
        name: 'inTheAnnouncement',
        component: () => import(/* webpackChunkName: "about" */ '../views/InTheAnnouncement.vue')
      },
      {
        path: '/theDepositIsNotAuthenticated',
        name: 'theDepositIsNotAuthenticated',
        component: () => import(/* webpackChunkName: "about" */ '../views/TheDepositIsNotAuthenticated.vue')
      },
      {
        path: '/registrationSucceeded',
        name: 'registrationSucceeded',
        component: () => import(/* webpackChunkName: "about" */ '../views/RegistrationSucceeded.vue')
      },
      {
        path: '/personalCenter',
        name: 'personalCenter',
        component: () => import(/* webpackChunkName: "about" */ '../views/PersonalCenterView.vue')
      },
      {
        path: '/earnestMoneyPage',
        name: 'earnestMoneyPage',
        component: () => import(/* webpackChunkName: "about" */ '../views/EarnestMoneyPage.vue')
      },
      {
        path: '/myAuction',
        name: 'myAuction',
        component: () => import(/* webpackChunkName: "about" */ '../views/MyAuction.vue'),
        redirect: '/auctionView',
        children: [
          {
            path: '/auctionView',
            name: 'auctionView',
            component: () => import(/* webpackChunkName: "about" */ '../views/AuctionView.vue')
          }
        ]
      },
      {
        path: '/searchView',
        name: 'searchView',
        component: () => import(/* webpackChunkName: "about" */ '../views/SearchView.vue')
      },
      {
        path: '/myBidding',
        name: 'myBidding',
        component: () => import(/* webpackChunkName: "about" */ '../views/MyBidding.vue'),
        redirect: '/biddingView',
        children: [
          {
            path: '/biddingView',
            name: 'biddingView',
            component: () => import(/* webpackChunkName: "about" */ '../views/BiddingView.vue')
          },
          {
            path: '/entrustView',
            name: 'entrustView',
            component: () => import(/* webpackChunkName: "about" */ '../views/EntrustView.vue')
          },
          {
            path: '/orderForGoods',
            name: 'orderForGoods',
            component: () => import(/* webpackChunkName: "about" */ '../views/OrderForGoods.vue')
          },
          {
            path: '/runningWater',
            name: 'runningWater',
            component: () => import(/* webpackChunkName: "about" */ '../views/RunningWater.vue')
          },
          {
            path: '/followWithInterest',
            name: 'followWithInterest',
            component: () => import(/* webpackChunkName: "about" */ '../views/FollowWithInterest.vue')
          },
          {
            path: '/meansView',
            name: 'meansView',
            component: () => import(/* webpackChunkName: "about" */ '../views/MeansView.vue')
          }
        ]
      },
      {
        path: '/releaseGoodsView',
        name: 'releaseGoodsView',
        component: () => import(/* webpackChunkName: "about" */ '../views/ReleaseGoodsView.vue')
      },
      {
        path: '/setAuctionInfoPage',
        name: 'setAuctionInfoPage',
        component: () => import(/* webpackChunkName: "about" */ '../views/SetAuctionInfoPage.vue')
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: loginPage
  }
]
const router = new VueRouter({
  routes,
  scrollBehavior (to, from, savedPosition) {
    // 解决路由跳转后 会滚动到底部
    if (savedPosition) {
      return savedPosition
    } else {
      return { x: 0, y: 0 }
    }
  }
})
// 路由守卫
export default router
